The present invention relates to a method for aggregating data in a network, particularly in a wireless sensor network, wherein the network comprises a plurality of sensor nodes to measure data and at least one sink node at which the data measured by the sensor nodes are aggregated, and wherein each sensor node encrypts its measured data with a key ki and forwards the result towards the sink node.